const Eos = require('eosjs');
async function test(){
    const verbose = false
    // let chainId = 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906'
    
    const eos = Eos({
        httpEndpoint: 'https://eos.greymass.com',
        // chainId,
        verbose
    })
    const info = await eos.getInfo({})
    // console.log(info)
    const chainId = info.chain_id
    const expireInSeconds = 60 * 60 // 1 hour
    const chainDate = new Date(info.head_block_time + 'Z')
    const expiration = new Date(chainDate.getTime() + expireInSeconds * 1000).toISOString().split('.')[0]
    const block = await eos.getBlock(info.last_irreversible_block_num)
    const txHeader = {
        expiration,
        ref_block_num: info.last_irreversible_block_num & 0xFFFF,
        ref_block_prefix: block.ref_block_prefix
    }
    const header =  { txHeader, chainId, eos }
    return header
}


test().then(res=>console.log(res))